<template>
  <div class="hello">
    <HeaDer :Title='$route.matched[0].name'></HeaDer>
    <van-badge-group :active-key="activeKey">
      <van-badge title="标签名称" @click="onClick" info="8" />
      <van-badge title="标签名称" @click="onClick" info="8" />
      <van-badge title="标签名称" @click="onClick" info="9" />
      <van-badge title="标签名称" @click="onClick" info="9" />
    </van-badge-group>
    <FooTer :Active="activeKey"></FooTer>
  </div>
</template>

<script>
import Header from "./index/header.vue";
import Footer from "./index/footer.vue";
export default {
  // 数据
  data() {
    return {
      activeKey: 0,
    };
  },
  // 当数据发生改变时
  watch: {},
  // 方法
  methods: {
    onClick(key) {
      this.activeKey = key;
    }
  },
  // 路由发生变化时
  beforeRouteLeave (to, from, next) {
    var conent = this;
    next()
  },
  // 加载模块
  components:{
    "HeaDer":Header,
    "FooTer":Footer
  },
  // 加载执行
  created:function(){ 
    var conent = this;
    conent.$http.get(conent.$http.getNewInfo,{params:{type:2}}).then(function (response) {
      if (response.data.code == "200") {
       console.log(response.data)
      }
    }).catch(function (error) {});
  }
};
</script>